<#include "../../page.ftl" />
<#assign security=JspTaglibs["/WEB-INF/security.tld"] />
<div class="tile-body" style="height: 410px;">
    <div class="dd" id="nestable3">
        <ol class="dd-list">
            <li class="dd-item dd3-item " data-id="1">
                <div class="dd3-content"><strong>家康运营管理系统</strong>

                    <div class="controls">
                    <@security.authorize ifAnyGranted="ROLE_MENU_A">
                        <a onclick="return popAddOrModify();" data-toggle="tooltip" data-placement="top" title="新增"
                           data-original-title="新增">
                            <i class="fa fa-plus-square-o"></i></a>
                    </@security.authorize>
                    </div>
                </div>
            <#if menusTable??>
                <#list menusTable as menu>
                    <ol class="dd-list">
                        <li class="dd-item dd3-item dd-field" data-id="5">
                            <div class="dd3-content">${menu.menuName!''}
                                <input type="hidden" name="ids" value="${menu.id!''}"/>
                                <input type="hidden" name="menuId" value="${menu.menuId!''}"/>

                                <div class="controls">
                                    <@security.authorize ifAnyGranted="ROLE_MENU_A">
                                        <a onclick="return popAddOrModify('${menu.menuId!''}');" data-toggle="tooltip"
                                           data-placement="top" title="新增" data-original-title="新增">
                                            <i class="fa fa-plus-square-o"></i></a>
                                    </@security.authorize>
                                    <@security.authorize ifAnyGranted="ROLE_MENU_E">
                                        <a onclick="return popEditOrModify(${menu.id!''});" data-toggle="tooltip"
                                           data-placement="top" title="编辑" data-original-title="编辑">
                                            <i class="fa fa-pencil-square-o"></i></a>
                                    </@security.authorize>
                                    <@security.authorize ifAnyGranted="ROLE_MENU_D">
                                        <a onclick="return deleteMenu(${menu.id!''},'${menu.menuId!''}');"
                                           data-toggle="tooltip" data-placement="top" title="删除"
                                           data-original-title="删除">
                                            <i class="fa fa-times"></i></a>
                                    </@security.authorize>
                                </div>
                            </div>
                            <#if menu.childrenMenuList??>
                                <#assign menusTable=menu.childrenMenuList/>
                                <#include "childerMenu.ftl"/>
                            </#if>
                        </li>
                    </ol>
                </#list>
            </#if>
            </li>
        </ol>
    </div>
</div>
<script>
    $(function () {
        var updateOutput = function (e) {
            var list = e.length ? e : $(e.target);
            output = list.data('output');
            if (window.JSON) {
                $(output).val(window.JSON.stringify(list.nestable('serialize')));//, null, 2));
            } else {
                output.val('JSON browser support required for this demo.');
            }
        };
        $('#nestable3').nestable({
            group: 1
        }).on('change', updateOutput);
        $('.dd3-content .dropdown-menu input').click(function (e) {
            e.preventDefault();
            e.stopPropagation();
        });

        $("#tableContent .tile-body:first").niceScroll();

    });
</script>

